import axios from 'axios';

const KWHttpRequest = axios.create({
  baseURL: '/',
  timeout: 5000,
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  transformResponse: function (data) {
    const response: any = JSON.parse(data);
    if (response.code !== 0) {
      console.log(response.code, response);
    }
    return response.data || null;
  }
});

export default KWHttpRequest;